<?xml version="1.0" encoding="utf-8"?>
<ControllerConfig Name="HC06M" Id="32">	
<Scripts>	  
  <Script ID="OnCableTypeChangeScript">
			<![CDATA[
							function getKoeffByCableType(k, t)
							{
								var arrA = new Array(-0.004247, -0.002235, -0.000227, -0.0002322, 0.000055, -0.00016);
								var arrB = new Array(0.34532, 0.231136, 0.0537, 0.0925, -0.0304, 0.02517);
								var arrC = new Array(-13.7724, -11.635, -5.8317, -13.46, 4.5929, -1.8388);
								var arrD = new Array(224, 245.94, 265.24, 712.79, -138.51, 77.54);
								switch (k)
								{
									case 'A':
										return arrA[t];
										break;
									case 'B':
										return arrB[t];
										break;
									case 'C':
										return arrC[t];
										break;
									case 'D':
										return arrD[t];
										break;
								}								
							}
							
							{&KoeffA&} = getKoeffByCableType('A',{&CableType&} ); 
							{&KoeffB&} = getKoeffByCableType('B',{&CableType&}); 
							{&KoeffC&} = getKoeffByCableType('C',{&CableType&}); 
							{&KoeffD&} = getKoeffByCableType('D',{&CableType&}); 	
					]]>
  </Script> 
 <Script ID="CableLengthCalculateScript">
	 <![CDATA[ 
		{&CableLengthCalculate&} = 1;
	]]>
 </Script>
  <Script ID="OnLastKoeffInitScript">
			<![CDATA[						
				var arrA = new Array(-0.004247, -0.002235, -0.000227, -0.0002322, 0.000055, -0.00016);
				var arrB = new Array(0.34532, 0.231136, 0.0537, 0.0925, -0.0304, 0.02517);
				var arrC = new Array(-13.7724, -11.635, -5.8317, -13.46, 4.5929, -1.8388);
				var arrD = new Array(224, 245.94, 265.24, 712.79, -138.51, 77.54);
				
				{&CableType&} = 6;				
				for (i=0; i<=5; i++)
				{
					var a = Math.abs(arrA[i]);
					var a1 = Math.abs({&KoeffA&});
					
					if (((Math.abs(arrA[i])-Math.abs({&KoeffA&}))/Math.abs(arrA[i])*100) < 1 &&
						((Math.abs(arrB[i])-Math.abs({&KoeffB&}))/Math.abs(arrB[i])*100) < 1 &&
						((Math.abs(arrC[i])-Math.abs({&KoeffC&}))/Math.abs(arrC[i])*100) < 1 &&
						((Math.abs(arrD[i])-Math.abs({&KoeffD&}))/Math.abs(arrD[i])*100) < 1) 
					{
						{&CableType&} = i;
						break;
					}																
				}						
			]]>
  </Script>   
  <Script ID="BtnTestClick">
	 <![CDATA[ 
		[&CurrentCalibrationTemperature0&] = 999;
	]]>
 </Script>
</Scripts>
</ControllerConfig>
